<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      /**
       * @param {number[]} nums
       * @param {number} target
       * @return {number[]}
       */
      var twoSum = function (nums, target) {
        for (var i = 0; i < nums.length; i++) {
          for (var j = i + 1; j < nums.length; j++) {
            if(target === nums[i]+nums[j]){
              return [i,j]
            }
          }
        }
        // return nums;
      };

      var nums = [7, 4, 5, 3, 6, 4];
      console.log(twoSum(nums, 8));
    </script>
  </body>
</html>
